package com.open.capacity.exam.controller;

import com.open.capacity.common.model.ExamQuestionsSubject;
import com.open.capacity.common.web.PageResult;
import com.open.capacity.common.web.Result;
import com.open.capacity.exam.service.QuestionSubjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("questionSubject")
@Api(tags = "考题科目管理")
public class QuestionSubjectController {
    @Autowired
    private QuestionSubjectService sjService;

    /**
     * 条件查询
     * @param subject
     * @return
     */
    @GetMapping("/findAll")
    @ApiOperation(value = "条件查询考题科目")
    public PageResult<ExamQuestionsSubject> findAll(@RequestParam Map<String,Object> subject){
        return sjService.findAll(subject);
    }
    @PostMapping("/add")
    @ApiOperation(value = "添加科目")
    public Result addSubject(@RequestBody ExamQuestionsSubject subject){
        return sjService.addSubject(subject);
    }
    @PostMapping("/edit")
    @ApiOperation(value = "添加科目")
    public Result editSubject(@RequestBody ExamQuestionsSubject subject){
        return sjService.editSubject(subject);
    }
}
